/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.softnight.ui.comboboxmodel;

import br.com.softnight.dao.ClienteDAO;
import br.com.softnight.entidades.Cliente;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.swing.DefaultComboBoxModel;

/**
 *
 * @author Franklin
 */
public class ComboBoxModelCliente extends DefaultComboBoxModel {
   
    public ComboBoxModelCliente() {
        super();
    }

    public void atualiza() throws SQLException {
        this.removeAllElements();

        ClienteDAO clienteDAO = new ClienteDAO();
        ArrayList<Cliente> clientesAux = clienteDAO.consultaTodos();
        
        for (Cliente cliente : clientesAux) {
            this.addElement(cliente);
        }
    }
}
